var main = {};

var uid = util.getQuery("uid");



main.viewinit = function(){
	console.log(uid);
}

var wsurl = "";
var host = util.local.get("host");
if(host==null){
	wsurl = cfg.ws + cfg.defaultHost + ":" + cfg.defaultPort + cfg.defaultPath + "/main.ws";
}else{
	wsurl = cfg.ws + host + ":" + util.local.get("port") + util.local.get("path") + "/main.ws";
}
var ws = null;
if ('WebSocket' in window) { 
	ws = new WebSocket(wsurl+"?uid="+uid);
} else if ('MozWebSocket' in window) { 
	ws = new MozWebSocket(wsurl+"?uid="+uid); 
} else { 
	console.error("初始化 Main websocket 对象失败！");
	return; 
}


var gui = require('nw.gui');
var win = gui.Window.get();
